home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 January: Mac OS SDK / Dev.CD Jan 00 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / Appearance.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  14.9 KB  |  416 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        Appearance.h
  3.  
  4.      Contains:    Appearance Manager Interfaces.
  5.  
  6.      Version:    Technology:    Appearance 1.0.2
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1994-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __APPEARANCE__
  19. #define __APPEARANCE__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27. #ifndef __TEXTEDIT__
  28. #include <TextEdit.h>
  29. #endif
  30. #ifndef __QDOFFSCREEN__
  31. #include <QDOffscreen.h>
  32. #endif
  33.  
  34. /*——————————————————————————————————————————————————————————————————————————————————*/
  35. /* Appearance Manager constants, etc.                                                */
  36. /*——————————————————————————————————————————————————————————————————————————————————*/
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59.  
  60. enum {
  61.                                                                 /* Appearance Trap Number */
  62.     _AppearanceDispatch            = 0xAA74
  63. };
  64.  
  65. /* Gestalt selector and values for the Appearance Manager */
  66.  
  67. enum {
  68.     gestaltAppearanceAttr        = FOUR_CHAR_CODE('appr'),
  69.     gestaltAppearanceExists        = 0,
  70.     gestaltAppearanceCompatMode    = 1
  71. };
  72.  
  73. /* Gestalt selector for determining Appearance Manager version     */
  74. /* If this selector does not exist, but gestaltAppearanceAttr    */
  75. /* does, it indicates that the 1.0 version is installed. This    */
  76. /* gestalt returns a BCD number representing the version of the    */
  77. /* Appearance Manager that is currently running, e.g. 0x0101 for*/
  78. /* version 1.0.1.                                                */
  79.  
  80. enum {
  81.     gestaltAppearanceVersion    = FOUR_CHAR_CODE('apvr')
  82. };
  83.  
  84. /* Appearance Manager Apple Events (1.0.1 and later) */
  85.  
  86. enum {
  87.     kAppearanceEventClass        = FOUR_CHAR_CODE('appr'),        /* Event Class */
  88.     kAEThemeSwitch                = FOUR_CHAR_CODE('thme')        /* Event ID's: Theme Switched */
  89. };
  90.  
  91. /* Appearance Manager Error Codes */
  92.  
  93. enum {
  94.     appearanceBadBrushIndexErr    = -30560,                        /* pattern index invalid */
  95.     appearanceProcessRegisteredErr = -30561,
  96.     appearanceProcessNotRegisteredErr = -30562,
  97.     appearanceBadTextColorIndexErr = -30563,
  98.     appearanceThemeHasNoAccents    = -30564,
  99.     appearanceBadCursorIndexErr    = -30565
  100. };
  101.  
  102.  
  103. enum {
  104.     kThemeActiveDialogBackgroundBrush = 1,                        /* Dialogs */
  105.     kThemeInactiveDialogBackgroundBrush = 2,                    /* Dialogs */
  106.     kThemeActiveAlertBackgroundBrush = 3,
  107.     kThemeInactiveAlertBackgroundBrush = 4,
  108.     kThemeActiveModelessDialogBackgroundBrush = 5,
  109.     kThemeInactiveModelessDialogBackgroundBrush = 6,
  110.     kThemeActiveUtilityWindowBackgroundBrush = 7,                /* Miscellaneous */
  111.     kThemeInactiveUtilityWindowBackgroundBrush = 8,                /* Miscellaneous */
  112.     kThemeListViewSortColumnBackgroundBrush = 9,                /* Finder */
  113.     kThemeListViewBackgroundBrush = 10,
  114.     kThemeIconLabelBackgroundBrush = 11,
  115.     kThemeListViewSeparatorBrush = 12,
  116.     kThemeChasingArrowsBrush    = 13,
  117.     kThemeDragHiliteBrush        = 14,
  118.     kThemeDocumentWindowBackgroundBrush = 15,
  119.     kThemeFinderWindowBackgroundBrush = 16
  120. };
  121.  
  122. typedef SInt16                             ThemeBrush;
  123.  
  124. enum {
  125.     kThemeActiveDialogTextColor    = 1,                            /* Dialogs */
  126.     kThemeInactiveDialogTextColor = 2,
  127.     kThemeActiveAlertTextColor    = 3,
  128.     kThemeInactiveAlertTextColor = 4,
  129.     kThemeActiveModelessDialogTextColor = 5,
  130.     kThemeInactiveModelessDialogTextColor = 6,
  131.     kThemeActiveWindowHeaderTextColor = 7,                        /* Primitives */
  132.     kThemeInactiveWindowHeaderTextColor = 8,
  133.     kThemeActivePlacardTextColor = 9,                            /* Primitives */
  134.     kThemeInactivePlacardTextColor = 10,
  135.     kThemePressedPlacardTextColor = 11,
  136.     kThemeActivePushButtonTextColor = 12,                        /* Primitives */
  137.     kThemeInactivePushButtonTextColor = 13,
  138.     kThemePressedPushButtonTextColor = 14,
  139.     kThemeActiveBevelButtonTextColor = 15,                        /* Primitives */
  140.     kThemeInactiveBevelButtonTextColor = 16,
  141.     kThemePressedBevelButtonTextColor = 17,
  142.     kThemeActivePopupButtonTextColor = 18,                        /* Primitives */
  143.     kThemeInactivePopupButtonTextColor = 19,
  144.     kThemePressedPopupButtonTextColor = 20,
  145.     kThemeIconLabelTextColor    = 21,                            /* Finder */
  146.     kThemeListViewTextColor        = 22
  147. };
  148.  
  149. /* Text Colors available in Appearance 1.0.1 or later */
  150.  
  151. enum {
  152.     kThemeActiveDocumentWindowTitleTextColor = 23,
  153.     kThemeInactiveDocumentWindowTitleTextColor = 24,
  154.     kThemeActiveMovableModalWindowTitleTextColor = 25,
  155.     kThemeInactiveMovableModalWindowTitleTextColor = 26,
  156.     kThemeActiveUtilityWindowTitleTextColor = 27,
  157.     kThemeInactiveUtilityWindowTitleTextColor = 28,
  158.     kThemeActivePopupWindowTitleColor = 29,
  159.     kThemeInactivePopupWindowTitleColor = 30,
  160.     kThemeActiveRootMenuTextColor = 31,
  161.     kThemeSelectedRootMenuTextColor = 32,
  162.     kThemeDisabledRootMenuTextColor = 33,
  163.     kThemeActiveMenuItemTextColor = 34,
  164.     kThemeSelectedMenuItemTextColor = 35,
  165.     kThemeDisabledMenuItemTextColor = 36,
  166.     kThemeActivePopupLabelTextColor = 37,
  167.     kThemeInactivePopupLabelTextColor = 38
  168. };
  169.  
  170. typedef SInt16                             ThemeTextColor;
  171. /* States to draw primitives: disabled, active, and pressed (hilited) */
  172.  
  173. enum {
  174.     kThemeStateDisabled            = 0,
  175.     kThemeStateActive            = 1,
  176.     kThemeStatePressed            = 2
  177. };
  178.  
  179. typedef UInt32                             ThemeDrawState;
  180. /*——————————————————————————————————————————————————————————————————————————————————*/
  181. /* Theme menu bar drawing states                                                    */
  182. /*——————————————————————————————————————————————————————————————————————————————————*/
  183.  
  184. enum {
  185.     kThemeMenuBarNormal            = 0,
  186.     kThemeMenuBarSelected        = 1
  187. };
  188.  
  189. typedef SInt16                             ThemeMenuBarState;
  190. /* attributes */
  191.  
  192. enum {
  193.     kThemeMenuSquareMenuBar        = (1 << 0)
  194. };
  195.  
  196. /*——————————————————————————————————————————————————————————————————————————————————*/
  197. /* Theme menu drawing states                                                        */
  198. /*——————————————————————————————————————————————————————————————————————————————————*/
  199.  
  200. enum {
  201.     kThemeMenuActive            = 0,
  202.     kThemeMenuSelected            = 1,
  203.     kThemeMenuDisabled            = 3
  204. };
  205.  
  206. typedef SInt16                             ThemeMenuState;
  207.  
  208. enum {
  209.     kThemeMenuTypePullDown        = 0,
  210.     kThemeMenuTypePopUp            = 1,
  211.     kThemeMenuTypeHierarchical    = 2
  212. };
  213.  
  214. typedef SInt16                             ThemeMenuType;
  215.  
  216. enum {
  217.     kThemeMenuItemPlain            = 0,
  218.     kThemeMenuItemHierarchical    = 1,
  219.     kThemeMenuItemScrollUpArrow    = 2,
  220.     kThemeMenuItemScrollDownArrow = 3
  221. };
  222.  
  223. typedef SInt16                             ThemeMenuItemType;
  224. /*——————————————————————————————————————————————————————————————————————————————————*/
  225. /* Menu Drawing callbacks                                                            */
  226. /*——————————————————————————————————————————————————————————————————————————————————*/
  227. typedef CALLBACK_API( void , MenuTitleDrawingProcPtr )(const Rect *inBounds, SInt16 inDepth, Boolean inIsColorDevice, SInt32 inUserData);
  228. typedef CALLBACK_API( void , MenuItemDrawingProcPtr )(const Rect *inBounds, SInt16 inDepth, Boolean inIsColorDevice, SInt32 inUserData);
  229. typedef STACK_UPP_TYPE(MenuTitleDrawingProcPtr)                 MenuTitleDrawingUPP;
  230. typedef STACK_UPP_TYPE(MenuItemDrawingProcPtr)                     MenuItemDrawingUPP;
  231. enum { uppMenuTitleDrawingProcInfo = 0x000036C0 };                 /* pascal no_return_value Func(4_bytes, 2_bytes, 1_byte, 4_bytes) */
  232. enum { uppMenuItemDrawingProcInfo = 0x000036C0 };                 /* pascal no_return_value Func(4_bytes, 2_bytes, 1_byte, 4_bytes) */
  233. #define NewMenuTitleDrawingProc(userRoutine)                     (MenuTitleDrawingUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuTitleDrawingProcInfo, GetCurrentArchitecture())
  234. #define NewMenuItemDrawingProc(userRoutine)                     (MenuItemDrawingUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuItemDrawingProcInfo, GetCurrentArchitecture())
  235. #define CallMenuTitleDrawingProc(userRoutine, inBounds, inDepth, inIsColorDevice, inUserData)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppMenuTitleDrawingProcInfo, (inBounds), (inDepth), (inIsColorDevice), (inUserData))
  236. #define CallMenuItemDrawingProc(userRoutine, inBounds, inDepth, inIsColorDevice, inUserData)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppMenuItemDrawingProcInfo, (inBounds), (inDepth), (inIsColorDevice), (inUserData))
  237.  
  238.  
  239. /*——————————————————————————————————————————————————————————————————————————————————*/
  240. /*    Appearance Manager APIs                                                            */
  241. /*——————————————————————————————————————————————————————————————————————————————————*/
  242. /* Registering Appearance-Savvy Applications */
  243. EXTERN_API( OSStatus )
  244. RegisterAppearanceClient        (void)                                                        THREEWORDINLINE(0x303C, 0x0015, 0xAA74);
  245.  
  246. EXTERN_API( OSStatus )
  247. UnregisterAppearanceClient        (void)                                                        THREEWORDINLINE(0x303C, 0x0016, 0xAA74);
  248.  
  249. /*****************************************************************************
  250.     NOTES ON THEME BRUSHES
  251.     Theme brushes can be either colors or patterns, depending on the theme.
  252.     Because of this, you should be prepared to handle the case where a brush
  253.     is a pattern and save and restore the pnPixPat and bkPixPat fields of
  254.     your GrafPorts when saving the fore and back colors. Also, since patterns
  255.     in bkPixPat override the background color of the window, you should use
  256.     BackPat to set your background pattern to a normal white pattern. This
  257.     will ensure that you can use RGBBackColor to set your back color to white,
  258.     call EraseRect and get the expected results.
  259. *****************************************************************************/
  260.  
  261. EXTERN_API( OSStatus )
  262. SetThemePen                        (ThemeBrush             inBrush,
  263.                                  SInt16                 inDepth,
  264.                                  Boolean                 inIsColorDevice)                    THREEWORDINLINE(0x303C, 0x0001, 0xAA74);
  265.  
  266. EXTERN_API( OSStatus )
  267. SetThemeBackground                (ThemeBrush             inBrush,
  268.                                  SInt16                 inDepth,
  269.                                  Boolean                 inIsColorDevice)                    THREEWORDINLINE(0x303C, 0x0002, 0xAA74);
  270.  
  271. EXTERN_API( OSStatus )
  272. SetThemeTextColor                (ThemeTextColor         inColor,
  273.                                  SInt16                 inDepth,
  274.                                  Boolean                 inIsColorDevice)                    THREEWORDINLINE(0x303C, 0x0003, 0xAA74);
  275.  
  276. EXTERN_API( OSStatus )
  277. SetThemeWindowBackground        (WindowPtr                 inWindow,
  278.                                  ThemeBrush             inBrush,
  279.                                  Boolean                 inUpdate)                            THREEWORDINLINE(0x303C, 0x0004, 0xAA74);
  280.  
  281. /* Window Placards, Headers and Frames */
  282. EXTERN_API( OSStatus )
  283. DrawThemeWindowHeader            (const Rect *            inRect,
  284.                                  ThemeDrawState         inState)                            THREEWORDINLINE(0x303C, 0x0005, 0xAA74);
  285.  
  286. EXTERN_API( OSStatus )
  287. DrawThemeWindowListViewHeader    (const Rect *            inRect,
  288.                                  ThemeDrawState         inState)                            THREEWORDINLINE(0x303C, 0x0006, 0xAA74);
  289.  
  290. EXTERN_API( OSStatus )
  291. DrawThemePlacard                (const Rect *            inRect,
  292.                                  ThemeDrawState         inState)                            THREEWORDINLINE(0x303C, 0x0007, 0xAA74);
  293.  
  294. EXTERN_API( OSStatus )
  295. DrawThemeEditTextFrame            (const Rect *            inRect,
  296.                                  ThemeDrawState         inState)                            THREEWORDINLINE(0x303C, 0x0009, 0xAA74);
  297.  
  298. EXTERN_API( OSStatus )
  299. DrawThemeListBoxFrame            (const Rect *            inRect,
  300.                                  ThemeDrawState         inState)                            THREEWORDINLINE(0x303C, 0x000A, 0xAA74);
  301.  
  302. /* Keyboard Focus Drawing */
  303. EXTERN_API( OSStatus )
  304. DrawThemeFocusRect                (const Rect *            inRect,
  305.                                  Boolean                 inHasFocus)                            THREEWORDINLINE(0x303C, 0x000B, 0xAA74);
  306.  
  307. /* Dialog Group Boxes and Separators */
  308. EXTERN_API( OSStatus )
  309. DrawThemePrimaryGroup            (const Rect *            inRect,
  310.                                  ThemeDrawState         inState)                            THREEWORDINLINE(0x303C, 0x000C, 0xAA74);
  311.  
  312. EXTERN_API( OSStatus )
  313. DrawThemeSecondaryGroup            (const Rect *            inRect,
  314.                                  ThemeDrawState         inState)                            THREEWORDINLINE(0x303C, 0x000D, 0xAA74);
  315.  
  316. EXTERN_API( OSStatus )
  317. DrawThemeSeparator                (const Rect *            inRect,
  318.                                  ThemeDrawState         inState)                            THREEWORDINLINE(0x303C, 0x000E, 0xAA74);
  319.  
  320. /* -------------------- BEGIN APPEARANCE 1.0.1 -------------------------------------*/
  321. /* The following Appearance Manager APIs are only available */
  322. /* in Appearance 1.0.1 or later                             */
  323. EXTERN_API( OSStatus )
  324. DrawThemeModelessDialogFrame    (const Rect *            inRect,
  325.                                  ThemeDrawState         inState)                            THREEWORDINLINE(0x303C, 0x0008, 0xAA74);
  326.  
  327. EXTERN_API( OSStatus )
  328. DrawThemeGenericWell            (const Rect *            inRect,
  329.                                  ThemeDrawState         inState,
  330.                                  Boolean                 inFillCenter)                        THREEWORDINLINE(0x303C, 0x0022, 0xAA74);
  331.  
  332. EXTERN_API( OSStatus )
  333. DrawThemeFocusRegion            (RgnHandle                 inRegion,
  334.                                  Boolean                 inHasFocus)                            THREEWORDINLINE(0x303C, 0x0023, 0xAA74);
  335.  
  336. EXTERN_API( Boolean )
  337. IsThemeInColor                    (SInt16                 inDepth,
  338.                                  Boolean                 inIsColorDevice)                    THREEWORDINLINE(0x303C, 0x0024, 0xAA74);
  339.  
  340. /* IMPORTANT: GetThemeAccentColors will only work in the platinum theme. Any other theme will */
  341. /* most likely return an error */
  342. EXTERN_API( OSStatus )
  343. GetThemeAccentColors            (CTabHandle *            outColors)                            THREEWORDINLINE(0x303C, 0x0025, 0xAA74);
  344.  
  345. EXTERN_API( OSStatus )
  346. DrawThemeMenuBarBackground        (const Rect *            inBounds,
  347.                                  ThemeMenuBarState         inState,
  348.                                  UInt32                 inAttributes)                        THREEWORDINLINE(0x303C, 0x0018, 0xAA74);
  349.  
  350. EXTERN_API( OSStatus )
  351. DrawThemeMenuTitle                (const Rect *            inMenuBarRect,
  352.                                  const Rect *            inTitleRect,
  353.                                  ThemeMenuState         inState,
  354.                                  UInt32                 inAttributes,
  355.                                  MenuTitleDrawingUPP     inTitleProc,
  356.                                  UInt32                 inTitleData)                        THREEWORDINLINE(0x303C, 0x0019, 0xAA74);
  357.  
  358. EXTERN_API( OSStatus )
  359. GetThemeMenuBarHeight            (SInt16 *                outHeight)                            THREEWORDINLINE(0x303C, 0x001A, 0xAA74);
  360.  
  361. EXTERN_API( OSStatus )
  362. DrawThemeMenuBackground            (const Rect *            inMenuRect,
  363.                                  ThemeMenuType             inMenuType)                            THREEWORDINLINE(0x303C, 0x001B, 0xAA74);
  364.  
  365. EXTERN_API( OSStatus )
  366. GetThemeMenuBackgroundRegion    (const Rect *            inMenuRect,
  367.                                  ThemeMenuType             menuType,
  368.                                  RgnHandle                 region)                                THREEWORDINLINE(0x303C, 0x001C, 0xAA74);
  369.  
  370. EXTERN_API( OSStatus )
  371. DrawThemeMenuItem                (const Rect *            inMenuRect,
  372.                                  const Rect *            inItemRect,
  373.                                  SInt16                 inVirtualMenuTop,
  374.                                  SInt16                 inVirtualMenuBottom,
  375.                                  ThemeMenuState         inState,
  376.                                  ThemeMenuItemType         inItemType,
  377.                                  MenuItemDrawingUPP     inDrawProc,
  378.                                  UInt32                 inUserData)                            THREEWORDINLINE(0x303C, 0x001D, 0xAA74);
  379.  
  380. EXTERN_API( OSStatus )
  381. DrawThemeMenuSeparator            (const Rect *            inItemRect)                            THREEWORDINLINE(0x303C, 0x001E, 0xAA74);
  382.  
  383. EXTERN_API( OSStatus )
  384. GetThemeMenuSeparatorHeight        (SInt16 *                outHeight)                            THREEWORDINLINE(0x303C, 0x001F, 0xAA74);
  385.  
  386. EXTERN_API( OSStatus )
  387. GetThemeMenuItemExtra            (ThemeMenuItemType         inItemType,
  388.                                  SInt16 *                outHeight,
  389.                                  SInt16 *                outWidth)                            THREEWORDINLINE(0x303C, 0x0020, 0xAA74);
  390.  
  391. EXTERN_API( OSStatus )
  392. GetThemeMenuTitleExtra            (SInt16 *                outWidth,
  393.                                  Boolean                 inIsSquished)                        THREEWORDINLINE(0x303C, 0x0021, 0xAA74);
  394.  
  395.  
  396. #if PRAGMA_STRUCT_ALIGN
  397.     #pragma options align=reset
  398. #elif PRAGMA_STRUCT_PACKPUSH
  399.     #pragma pack(pop)
  400. #elif PRAGMA_STRUCT_PACK
  401.     #pragma pack()
  402. #endif
  403.  
  404. #ifdef PRAGMA_IMPORT_OFF
  405. #pragma import off
  406. #elif PRAGMA_IMPORT
  407. #pragma import reset
  408. #endif
  409.  
  410. #ifdef __cplusplus
  411. }
  412. #endif
  413.  
  414. #endif /* __APPEARANCE__ */
  415.  
  416.